home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / knowhow4 / kh_draw.cpp < prev    next >
C/C++ Source or Header  |  1994-10-10  |  20KB  |  465 lines

  1. #include "kh_draw.h"
  2.  
  3. int application(int) { return 0; }  // dummy function - will not be in use
  4. rect r_draw_size;      // == bound of draw object, expanded or not
  5.  
  6. KH_Draw::KH_Draw(char* fileName, char* bufName, int obj_num, int step)
  7.     : ApplicationKit(step, loc(39, 13))
  8.     {
  9.     set_object_number(obj_num);
  10.     DATA_TOOLS = DATA_FILE = DATA_LINE = DATA_EDIT =
  11.     DATA_FILTER = DATA_DITHER = 1;    // See TOOLS.H
  12.     DATA_DIR = DATA_ATTR = DATA_BAK = DATA_FILL = DATA_ZOOM
  13.     = DATA_GRAD = DATA_ERROR_PROP = DATA_PRINT = DATA_TRANS = DATA_PREVIEW
  14.     = 0;
  15.     DATA_SIZE = 1;
  16.     DATA_X = DATA_Y = 0;
  17.  
  18.     fontName = strdup("hv08a.sfp");
  19. // constructors for objects
  20.     rect r_base(0, 0, 80, 25);
  21.     w1 = new Window(r_base, fileName, "", 0, BUTTON_BORDER, NO_BORDER,
  22.            MOVE | RESIZE, 0, 0);
  23. //////////////////////////////
  24.     rect r_draw(8, 2, 80, 24);
  25. //    rect r_draw(9, 2, 80, 23);
  26.     draw = new BlockDraw(r_draw);
  27.     draw->draw->kh_draw = this;
  28. //////////////////////////////
  29.     rect r_menu(5, 0, 80, 2);
  30.     static char* hotMenuList = "FOETMSP";       // hot for line menu
  31.     static char* menuList[] = { " File", " Options", " Effects",
  32.     " Text", " Method", " Scripts", " Print", "" };
  33.     menu = new
  34.     BlockLineMenu(r_menu, "", hotMenuList, menuList, rect(0, 24, 79, 25),
  35.            /*STATUSTYPE*/ 0, /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  36.            BUTTON_BORDER, 16, 16, 16);
  37. ////////////////////////////////
  38. //    rect r_tool_panel1(0, 4, 8, 10);
  39.     rect r_tool_panel1(0, 2, 8, 8);
  40.     static int ic_effects_list1[] = { I_UNDO, I_FILTERS,
  41.     I_DITHERS, I_TEXT, I_SCROLL, I_LOCAL_UNDO, 0 };        // tools
  42.     tool_panel1 = new
  43.     IconMenu(r_tool_panel1, "", "", /*HOT*/ NULL, /*POS*/ 1,
  44.            /*START*/ 1, SMALL_ICON, ic_effects_list1,
  45.            /*ITEMDISTANCE*/ loc(3, 3), rect(0, 0, 79, 25),
  46.            /*STATUSTYPE*/ 0, /*STATUSSTRINGS*/ NULL,
  47.            /*STATUSLIST*/ NULL, FIXED, /*s*/ 0, BUTTON_BORDER,
  48.            NO_BORDER);
  49. ////////////////////////////////
  50. //    rect r_tool_panel(1, 3, 9, 9);
  51.     rect r_tool_panel(0, 11, 8, 20);
  52.     static int ic_list1[] = { I_LINES, I_MICROSCOPE,
  53.                I_SCISSORS, I_ERASER,
  54.                I_COLOR_ERASER, I_FILL, I_RECTANGLE,  I_CIRCLE,
  55.                I_LINE,   I_PEN,    0 };        // tools
  56.     loc t = pScreenSet->g_mode == VGAHI ? loc(3, 3) : loc(3, 2);
  57.     tool_panel = new IconMenu(r_tool_panel, "", "",
  58.               NULL, 1, 1, SMALL_ICON, ic_list1, t,
  59.               rect(0, 0, 25, 80), 0, NULL, NULL, FIXED, 0,
  60.               BUTTON_BORDER, NO_BORDER);
  61. ////////////////////////////////
  62.     rect r_resize_panel(0, 0, 5, 3);
  63.     static int ic_resize_list[] = { I_MOVE, I_RESIZE, 0 };
  64.     loc l = pScreenSet->g_mode == VGAHI ? loc(4, 4) : loc(4, 2);
  65.     resize_panel = new IconMenu(r_resize_panel, "", "",
  66.               NULL, 1, 1, SMALL_ICON, ic_resize_list, l,
  67.               rect(0, 0, 25, 80), 0, NULL, NULL, FIXED, 0,
  68.               BUTTON_BORDER, NO_BORDER);
  69. ////////////////////////////////
  70. int s = pScreenSet->g_driver == VGA ? 0 : 1;
  71.     rect r_lines_panel(12, 10, 30, 17 + s);
  72.     static int ic_list2[] = { I_LINE_1, I_LINE_2, I_LINE_3, I_LINE_4,
  73.                   I_LINE_5, I_LINE_6, 0 };  // line width
  74.     lines_panel = new
  75.     BlockPanel(r_lines_panel, "", "Line width", /*HOT*/ NULL,
  76.            SMALL_ICON, ic_list2, loc(3, 3), rect(0, 0, 79, 25),
  77.            /*STATUSTYPE*/ 0, /*STATUSSTRINGS*/ NULL,
  78.            /*STATUSLIST*/ NULL, FIXED, 6, SHOW_BORDER, SHOW_BORDER,
  79.            16, 16, 16, 16);
  80. ///////////////////
  81. /*    colors_panel = new ColorScrollBar(loc(0, 23), HORIZ, 36, 15, 1, 0);
  82. //////////////////////////
  83.     colors2_panel = new ColorScrollBar(loc(0, 24), HORIZ, 36, 15, 1, 0);
  84. ////////////////////////////////
  85.     rect r_fill_prompt(36, 23, 80, 25);
  86.     fill_prompt = new Element(r_fill_prompt, WHITE_ELEMENT);
  87. ////////////////////////////
  88. */
  89.     colors_panel = new ColorScrollBar(loc(0, 24), HORIZ, 36, 15, 1, 0);
  90. //////////////////////////
  91.     colors2_panel = new ColorScrollBar(loc(36, 24), HORIZ, 36, 15, 1, 0);
  92. ////////////////////////////////
  93.     rect r_fill_prompt(72, 24, 80, 25);
  94.     fill_prompt = new Element(r_fill_prompt, WHITE_ELEMENT);
  95. ////////////////////////////
  96.     rect r_fill_panel(8, 8, 60, 16 + s);
  97.     static int ic_fill[] = { I_FILL1, I_FILL2, I_FILL3, I_FILL4, I_FILL5,
  98.               I_FILL6, I_FILL7, I_FILL8, I_FILL9, I_FILL10,
  99.               I_FILL11, I_FILL12, I_FILL13, I_FILL14,
  100.               I_FILL15, I_FILL16, I_FILL17, I_FILL18,
  101.               I_FILL19, I_FILL20, I_FILL21, I_FILL22, I_FILL23,
  102.               I_FILL24, I_FILL25, I_FILL26, I_FILL27, I_FILL28,
  103.               I_FILL29, I_FILL30, I_FILL31, I_FILL32, I_FILL33,
  104.               I_FILL34, I_FILL35, I_FILL36, I_FILL37, I_FILL38,
  105.               I_FILL39, I_FILL40, I_FILL41, I_FILL42, I_FILL43,
  106.               I_FILL44, I_FILL45, I_FILL46, I_FILL47, I_FILL48, 0 };
  107.     fill_panel = new
  108.     BlockPanel(r_fill_panel, "", "", NULL, SMALL_ICON,
  109.            ic_fill, loc(5, 4), /*STATUSPOS*/ rect(0, 0, 79, 24),
  110.            /*STATUSTYPE*/ 0, /*STATUSSTRINGS*/ NULL,
  111.            /*STATUSLIST*/ NULL, MOVE | RESIZE, /*s*/ 6,
  112.            SHOW_BORDER, SHOW_BORDER, 16, 0, 16, 16);
  113. ///////////////////////
  114.     static char* filtersList[] = { "1", "2", "3", "4", "5", "6", "7", "8",
  115.                 "9", "10", "11", "12", "13", "14", "" };
  116.     rect r_filter(38, 7, 64, 13);
  117.     static char* hotFilterList = "123456789qwert";
  118.     filters = new
  119.     BlockMenu(r_filter, "", "", /*s*/ 6, hotFilterList,
  120.            filtersList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  121.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  122.            FIXED, SHOW_BORDER, NO_BORDER, 16, 0, 16, 16);
  123. //////////////////////////
  124.     rect r_dither(38, 7, 64, 13);
  125.     static char* dithersList[] = { "1", "2", "3", "4", "5", "6", "7", "8",
  126.                 "9", "10", "11", "12", "13", "14", "" };
  127.     static char* hotDitherList = "123456789qwert";
  128.     dithers = new
  129.     BlockMenu(r_dither, "", "", /*s*/ 0, hotDitherList,
  130.         dithersList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  131.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  132.            FIXED, SHOW_BORDER, NO_BORDER, 16, 0, 16, 16);
  133. //////////////////////////
  134.     rect r_grad(38, 7, 54, 14);
  135.     static char* gradList[] = { "No", "Horiz", "Vert", "" };
  136.     static char* hotGradList = "NHV";
  137.     grads = new BlockMenu(r_grad, "", "", 0, hotGradList,
  138.     gradList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  139.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  140.            FIXED, SHOW_BORDER, NO_BORDER, 16, 0, 16, 16);
  141. //////////////////////////
  142.     rect r_error_prop(38, 7, 53, 13);
  143.     static char* errorList[] = { "Pat", "Nopat", "" };
  144.     static char* hotErrorList = "PN";
  145.     error_prop = new BlockMenu(r_error_prop, "", "", 0, hotErrorList,
  146.     errorList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  147.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  148.            FIXED, SHOW_BORDER, NO_BORDER, 16, 0, 16, 16);
  149. ////////////////////////////
  150.     rect r_edit(15, 7, 65, 20);                 // Editor
  151.     editor = new
  152.     BlockWrite(r_edit, "", "work.txt", "Editor", /*s*/ 6,
  153.         MOVE | RESIZE, SHOW_BORDER, SHOW_BORDER, SHOW_BORDER,
  154.         16, 16, 16, 16);
  155. //////////////////////////
  156.     rect r_buf_size(30, 10, 72, 24);
  157.     static char* bufferSizeList[] = { " 1. screen", " 2. 744 x 550",
  158.                    " 3. 1896 x 2000", "4. 4000 x 4000",
  159.                    " 5. 8000 x 8000", " 6. 10000 x 16000",
  160.                    " 7. 12000 x 20000 ", "" };
  161.     static char* hotBufList = "1234567";         // buffer dimentions
  162.     buffer_size = new BlockMenu(r_buf_size, "", "", 6, hotBufList,
  163.     bufferSizeList, rect(0, 24, 69, 23), /*STATUSTYPE*/ 0,
  164.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  165.            FIXED, SHOW_BORDER, NO_BORDER, 16, 0, 16, 16);
  166. //////////////////////////
  167.     rect r_file = rect(5, 3, 30, 14 + s);
  168.     static char* hotFileList = "NOSB?";             // hot for file menu
  169.     static char* fileList[] = { " New ", " Open ",
  170.     " Save", " save B&w", " << ? >> ", "" };
  171.  
  172.     file_menu = new BlockMenu(r_file, "", " Files ", 6, hotFileList,
  173.     fileList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  174.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  175.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  176. ///////////////////////////
  177.     file_sys = new BlockFile("Files");
  178. //////////////////////////
  179.     rect r_edit_menu = rect(20, 3, 45, 18 + s);
  180.     static char* hotEditList = "COFSBHRTP";      // hot for edit menu
  181.     static char* editList[] = { "Cut", "cOpy", "copy From", "Save",
  182.              "save B&w", "sHow", "Rescale   ", "Transparent  ",
  183.              "Picture  ", "" };
  184.     edit_menu = new BlockMenu(r_edit_menu, "", "Options", 6,
  185.     hotEditList, editList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  186.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  187.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  188. //////////////////////////////
  189.     rect r_text = rect(40, 3, 62, 11 + s);
  190.     static char* hotTextList = "SDF";            // size-direction-font
  191.     static char* textList[] = { " Size", " Direction", " Font", "" };
  192.     text_menu = new BlockMenu(r_text, "", " Text ", 6,
  193.     hotTextList, textList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  194.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  195.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  196. /////////////////////////////
  197.     rect r_methods = rect(40, 3, 59, 15 + s);
  198.     static char* hotMethodsList = "'EMCBPD";       // Tools - Tools1 - Attr - Back - Pattern - Draw
  199.     static char* methodsList[] = { "Effect", "Method", "Color", "Back",
  200.      "Pattern", " Draw", "" };
  201.     methods_menu = new BlockMenu(r_methods, "", " Methods ", 6,
  202.     hotMethodsList, methodsList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  203.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  204.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  205. ///////////////////////////
  206.     rect r_effects = rect(25, 3, 45, 13);
  207.     static char* hotEffectsList = "FDGS";
  208.     static char* effectsList[] = { "Filter", "Dither", "Grad",
  209.     " Style", "" };
  210.     effects_menu = new BlockMenu(r_effects, "", "Effects", 6,
  211.     hotEffectsList, effectsList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  212.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  213.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  214. ///////////////////////////
  215.     rect r_font = rect(35, 5, 57, 11);
  216.     static char* hotDirList = "HV";              // Horiz - Vert
  217.     static char* dirList[] = { " Horiz", " Vert", "" };
  218.     dir_menu = new BlockMenu(r_font, "", " Orientation ", 6,
  219.     hotDirList, dirList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  220.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  221.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  222. //////////////////////////////
  223.     rect r_size = rect(10, 4, 35, 15 + s);
  224.     static char* sizeList[] = { "   1", "   2", "   3", "   4",
  225.              "   5", "   6", "   7", "   8",
  226.              "   9", "  10", "  12", "  14",
  227.              "  16", "  18", "  20", "" };
  228.     size_menu = new BlockMenu(r_size, "", "Zoom in", 6,
  229.     0, sizeList, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  230.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  231.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  232. //////////////////////////
  233.     rect r_script = rect(50, 4, 69, 15 + s);
  234.     static char* items_script[] = { " Play", " Record", " Stop", " Macros",
  235.     " Text", "" };
  236.     static char* hotScriptList = "PRSMT";         // for script menu
  237.     script_menu = new BlockMenu(r_script, "", " Scripts ", 6,
  238.     hotScriptList, items_script, rect(0, 24, 79, 25), /*STATUSTYPE*/ 0,
  239.            /*STATUSSTRINGS*/ NULL, /*STATUSLIST*/ NULL,
  240.            FIXED, SHOW_BORDER, SHOW_BORDER, 16, 16, 16, 16);
  241. ///////////////////////////
  242.     r_draw_size = draw->draw->user_screen();//rect(9, 2, 80, 24);    // init value for draw object == r_draw
  243. /////////////////////////////
  244.     micro = new Microscope(" Microscope ",
  245. //    rect(0, 0, 80, 23));
  246.      rect(0, 0, 80, 24));
  247. /////////////////////////////
  248.     rect r = draw->draw->user_screen();
  249.     r.corner.Y -= 1;
  250.     buffer = new GrafBuffer(loc(750, 550), bufName, r);
  251.     print = new PrintManager(EPSON9, DD, 1, rect(1, 1, 1, 1), 0,
  252.                           PAPER_ON, 6);
  253.     form = new Form();
  254. ///////////////////////////
  255. // We add objects to the container "kit".
  256.     background(w1);
  257.     add(menu);
  258.  
  259.     add(resize_panel);    // MOVE, RESIZE and CANCEL the program kit
  260.  
  261.     add(file_menu);       // go here from "menu"
  262.     add(edit_menu);
  263.     add(effects_menu);
  264.     add(text_menu);
  265.     add(methods_menu);
  266.     add(script_menu);
  267.     add(form);
  268.  
  269.     add(buffer_size);     // go here from "file_menu"
  270.     add(file_sys);
  271.     add(file_sys);
  272.     add(file_sys);
  273.  
  274.     add(filters);         // go here from "effects_menu"
  275.     add(dithers);
  276.     add(grads);
  277.     add(error_prop);
  278.  
  279.     add(size_menu);       // go here from "text_menu"
  280.     add(dir_menu);
  281.     add(file_sys);
  282.  
  283.     add(tool_panel1);     // go here from "methods menu"
  284.     add(tool_panel);
  285.     add(colors_panel);
  286.     add(colors2_panel);
  287.     add(fill_prompt);
  288.     add(draw);
  289.  
  290.     add(file_sys);       // go here from "script_menu"
  291.  
  292.     add(lines_panel);    // go here from "tool_panel"
  293.     add(micro);
  294.  
  295.     add(fill_panel);
  296.  
  297.     add(file_sys);
  298.     add(file_sys);
  299.     add(file_sys);
  300.     add(editor);
  301.  
  302. // We set the numbers (or the names, which may be transformed to number
  303. // of the objects which will be called after exiting from current object
  304. // with ENTER-like command.
  305. //    set_point(fill_prompt, fill_panel);
  306. // we set that after exiting from object with ENTER-like command it will
  307. // call function AC_DUMMY + no of menu choice - 1 from appl1.cpp file,
  308. // and then call object No ... in list. Note that it can overwrite the
  309. // set_point settings.
  310.     assign(w1, resize_panel, AC_MOVE);
  311.  
  312.     assign(fill_panel, fill_prompt, AC_FILL_PANEL);
  313.     assign(file_menu, menu, AC_FILE_MENU);
  314.     assign(buffer_size, file_menu, AC_NEW);  // ATTENTION!!! OPEN and SAVE
  315.                           // points to the same file_sys object.
  316.     assign(size_menu, text_menu, AC_TEXT_SIZE);
  317.     assign(tool_panel1, methods_menu, AC_TOOLS_1);
  318.     assign(file_sys, script_menu, AC_SCRIPT_PLAY);
  319.  
  320.     assign(lines_panel, tool_panel, AC_LINE_WIDTH);
  321.             // after 1th choice of tool_panel go to lines_panel,
  322.             // but before execute AC_DUMMY (it does nothing) but
  323.             // returns 2, this mean permission for jump to the next
  324.             // object in casscade. After 2th - execute DUMMY1 + 1,
  325.             // this function will change any flags, or do something
  326.             // else, but returns 1, this mean "do not go to the
  327.             // next object in cascade".
  328.             // We can also use:  tool_panel1->assign(lines_panel, AC_DUMMY1);
  329.     assign(0, tool_panel1, AC_TOOL_UNDO);
  330.     assign(0, form, AC_PRINT);
  331.  
  332.     assign(0, lines_panel, AC_LINE_1);
  333.     assign(0, colors_panel, AC_BLACK);
  334.     assign(0, colors2_panel, AC_BLACK1);
  335.     assign(0, fill_panel, AC_FILL1);
  336.  
  337.     assign(0, buffer_size, AC_BUFFER_SIZE);
  338.  
  339.     assign(0, size_menu, AC_SIZE1);
  340.     assign(0, dir_menu, AC_HORIZ);
  341.     assign(0, file_sys, AC_FILE);
  342.     assign(0, micro, AC_MICROSCOPE_2);
  343.  
  344.     assign(file_sys, edit_menu, AC_EDIT_CUT);
  345.  
  346.     assign(0, editor, AC_TEXT_EDIT);
  347.  
  348.     assign(0, filters, AC_FILTER1);
  349.     assign(0, dithers, AC_DITHER1);
  350.  
  351.     assign(filters, effects_menu, AC_FILTERS);
  352.  
  353.     assign(0, grads, AC_NO_GRAD);
  354.     assign(0, error_prop, AC_NO_ERROR_PROP);
  355.     set_exit(AC_ASK_EXIT);
  356.  
  357. // We can set the numbers (or the names, which may be transformed to number
  358. // of the objects which will be called after exiting from current object
  359. // with ESC-like command. If current object was called from another
  360. // object, its callFrom flag will be changed, correspondingly, so it is not
  361. // absolutely necessary : kit->set_call(file_menu, menu)...
  362. // default object hides itself after exiting. But to obtain first-second-third...
  363. // level menu cascade we must change return flag to 2. In this case menu
  364. // will hide itself after exiting with ESC-like command, and will not -
  365. // if the next menu must be called (ENTER command).
  366.     menu->set_ret(RET_CANCEL | RET_STACKED | RET_SHOW);
  367.     file_menu->set_ret(RET_MOUSE | RET_CANCEL);
  368.     filters->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
  369.     dithers->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
  370.     grads->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
  371.     error_prop->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
  372.     form->set_ret(RET_MOUSE | RET_CANCEL | RET_OK);
  373.     script_menu->set_ret(RET_CANCEL | RET_MOUSE | RET_TRANSFER);
  374.     edit_menu->set_ret(RET_OK | RET_CANCEL | RET_MOUSE | RET_TRANSFER);
  375.     effects_menu->set_ret(RET_CANCEL | RET_MOUSE);
  376.     lines_panel->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  377.     file_sys->set_ret(RET_CANCEL | RET_MOUSE | RET_TRANSFER);
  378.     fill_panel->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  379.     text_menu->set_ret(RET_MOUSE | RET_CANCEL);
  380.     methods_menu->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  381.     size_menu->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  382.     dir_menu->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  383.     micro->set_ret(RET_OK | RET_CANCEL);
  384.     buffer_size->set_ret(RET_OK | RET_CANCEL | RET_MOUSE);
  385.     editor->set_ret(RET_OK | RET_MOUSE | RET_CANCEL);
  386.  
  387.     w1->set_ret(RET_STACKED);
  388.     resize_panel->set_ret(RET_STACKED | RET_SHOW);
  389.     tool_panel1->set_ret(RET_STACKED | RET_SHOW);
  390.     tool_panel->set_ret(RET_STACKED | RET_SHOW);
  391.     colors_panel->set_ret(RET_STACKED | RET_SHOW);
  392.     colors2_panel->set_ret(RET_STACKED | RET_SHOW);
  393.     fill_prompt->set_ret(RET_STACKED | RET_SHOW);
  394.     draw->set_ret(RET_STACKED | RET_SHOW);
  395.  
  396. // Setting of the context help. ATTENTION!!! colors_panel have not context -
  397.     menu->set_help_context("common  ");            // it is not a container.
  398.     file_menu->set_help_context("file_sys");
  399.     lines_panel->set_help_context("lines   ");
  400.     edit_menu->set_help_context("edit    ");
  401.     text_menu->set_help_context("text    ");
  402.     methods_menu->set_help_context("methods ");
  403.     effects_menu->set_help_context("filters ");
  404.     size_menu->set_help_context("size    ");
  405.     micro->set_help_context("micro   ");
  406.     fill_panel->set_help_context("fill    ");
  407.     script_menu->set_help_context("script  ");
  408.     form->set_help_context("printset");
  409.     buffer_size->set_help_context("bufsize ");
  410.     filters->set_help_context("filters ");
  411.     dithers->set_help_context("dithers ");
  412.     }
  413. ///////////////////////////////
  414. KH_Draw::~KH_Draw()
  415.     {
  416.     delete print;
  417.     delete buffer;
  418.     delete fontName;
  419.     }
  420. /////////////////////////
  421. void KH_Draw::show()
  422.     {
  423.     mouseHideCursor();
  424.     WindowManager::show_window(w1);
  425.     WindowManager::show_window(tool_panel1);
  426.     WindowManager::show_window(tool_panel);
  427.     WindowManager::show_window(draw);
  428.     WindowManager::show_window(colors_panel);
  429.     WindowManager::show_window(colors2_panel);
  430.     WindowManager::show_window(fill_prompt);
  431.     WindowManager::show_window(menu);
  432.  
  433. //    WindowManager::show_window(resize_panel);
  434.  
  435.     moveTo(1);
  436.     mouseShowCursor();
  437.     }
  438. //////////////////////////
  439. void KH_Draw::rearrange()
  440.     {
  441.     rect coord = textRect(w1->bound());
  442.  
  443.     tool_panel1->repose(rect(coord.origin + loc(0, 4),
  444.                  coord.origin + loc(8, 9)));
  445.     tool_panel->repose(rect(coord.origin + loc(1, 3),
  446.                  coord.origin + loc(9, 10)));
  447.     draw->repose(rect(coord.origin + loc(9, 2),
  448.                  coord.corner - loc(1, 2)));
  449.     r_draw_size = r_draw_size = draw->draw->user_screen();//draw->bound();
  450.  
  451.     int i;
  452.     colors_panel->repose(rect(coord.origin.X, coord.corner.Y - 2,
  453.                   coord.origin.X + 36, coord.corner.Y - 1));
  454.     colors2_panel->repose(rect(coord.origin.X, coord.corner.Y - 1,
  455.                   coord.origin.X + 36, coord.corner.Y));
  456.     fill_prompt->repose(rect(coord.origin.X + 37, coord.corner.Y - 2,
  457.                   coord.corner.X, coord.corner.Y));
  458.  
  459.     menu->repose(rect(coord.origin.X + 5, coord.origin.Y,
  460.                  coord.corner.X, coord.origin.Y + 2));
  461.     resize_panel->repose(rect(coord.origin,
  462.                  coord.origin + loc(5, 3)));
  463.     rect r = draw->draw->user_screen();
  464.     buffer->set_screen_area(r);
  465.     }